#include "apue.h"
#include <time.h>

void cron() {
    int i= 0;
    time_t sec;
    struct tm * tm;
    char timestr[20];
    while (1) {
        sleep(60);
        i++;
        if (i % 5 == 0) {
            sec= time(NULL);
            tm= localtime(&sec);
            strftime(timestr, 20, "%Y-%m-%d %H:%M:%S", tm); 
            puts(timestr);
            printf("tm_sec: %d\n", tm->tm_sec);
        }
    }
}

int main() {
    cron();
}
